import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import request from 'utils/request';
import { CPAAS_IAM } from 'utils/config';
import { getCurrentOrganizationId } from 'utils/utils';
var organizationId = getCurrentOrganizationId();
/**
 * 获取表单数据
 * @param {Number} organizationId 租户id
 */

export function fetchPasswordPolicyList() {
  return _fetchPasswordPolicyList.apply(this, arguments);
}
/**
 * 更新表单数据
 * @param {Number} organizationId 租户id
 * @param {Number} id 数据id
 * @param {String} params 其他参数
 */

function _fetchPasswordPolicyList() {
  _fetchPasswordPolicyList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", request("".concat(CPAAS_IAM, "/v1/").concat(organizationId, "/password-policies"), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _fetchPasswordPolicyList.apply(this, arguments);
}

export function updatePasswordPolicy(_x) {
  return _updatePasswordPolicy.apply(this, arguments);
}

function _updatePasswordPolicy() {
  _updatePasswordPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(params) {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(CPAAS_IAM, "/v1/").concat(organizationId, "/password-policies"), {
              method: 'PUT',
              body: params
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _updatePasswordPolicy.apply(this, arguments);
}